<?php require_once('../mysqlUtil.php');
require_once('../islogin.php');

//获取请求参数

//查询数据库
$sql = "SELECT count(id) FROM `t_goods`";
//mysqli_query()
$result=$conn->query($sql);
$data = array();
if ($result->num_rows > 0) {
    // 准备返回的json数据
    if($row=$result->fetch_assoc()){
        $data['state']=true;
        $data['number']=$row['count(id)'];  
        echo json_encode($data);  
        
    //echo json_encode(array('state'=>true,'number'=>$row['count(id)']));   
    }
    
    //echo json_encode($data);   
} else {
    $data['state']=false;
    $data['msg']='查询失败';  
    echo json_encode($data);   
}

 
//$conn->close();
?>

